import requests,re,json,sys,you_get
from lxml import etree
from pyquery import PyQuery as pq

def Dowmload(path,url):
    sys.argv = ['you-get','-o',path,url]
    you_get.main()
def Method_1():
    url = 'https://search.bilibili.com/all?keyword=%E9%AC%BC%E7%95%9C'
    headers = {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.92 Safari/537.36"
    }
    r = requests.get(url,headers = headers).text
    h = etree.HTML(r)
    url1 = h.xpath('//*[@id="all-list"]/div[1]/div[2]/ul/li/a/@href')
    for i in url1:
        url2 = 'https:' + i
        path = './Video'
        Dowmload(path,url2)

